// import Vue from 'vue'
// import Vuex from 'vuex'
// Vue.use(Vuex)
// const store = new Vuex.Store({
//     state: {},
//     mutations: {},
//     actions: {}
// })
// export default store



/*
 * @Author: your name
 * @Date: 2021-04-28 13:40:27
 * @LastEditTime: 2021-06-04 09:45:50
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \newlogistics\src\store\index.js
 */
import Vue from "vue";
import Vuex from "vuex";

import getters from "./getters";

Vue.use(Vuex);
const modulesFiles = require.context("./modules", true, /\.js$/);

// 您不需要`从'./modules/app'导入应用程序`
// 它会自动需要modules文件中的所有vuex模块
const modules = modulesFiles.keys().reduce((modules, modulePath) => {
  // set './app.js' => 'app'
  const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, "$1");
  const value = modulesFiles(modulePath);
  modules[moduleName] = value.default;
  return modules;
}, {});

// 生成一个vuex实例
const store = new Vuex.Store({
  modules,
  getters
});

export default store;